home > .cgi > Your own server

 

.home
.news
.sites
.free downloads
.tips & tricks
.web builder
.cgi
.intro to Perl
.your own server
.add a chatroom
.uploading CGI
.bughunting
.using PWS
.smart ass
.resources
.in-depth articles
.magazine
.forums
.contacts
.site map
.IE5 companion
.cgi
Need to supercharge your Web site? Got a database of products, and no way to get them online. You need to harness the power of CGI programming. Using languages such as Perl, ASP and PHP, you can create interactive, intelligent sites. This is part one of the series that appeared in .net magazine. Subscribe now so you don't any of the upcoming articles!
 

Continued...

Serving yourself

Enough background. Onto some Perl hacking. All you really need to get your scripts working is good old Notepad (or another text editor) and some Web space with a CGI bin. You've got almost certainly Notepad already, and you'll find a list of completely free hosts in the Resources section.

But it's useful to try out your Perl scripts on your own computer before you upload them. It'll save you the connection charges while you figure things out, and makes ironing out bugs much easier. For this you'll need a Web server and a Perl interpreter.

Click to view full size

Check you've got a green Xitami icon at the bottom right of your screen. If it's red, the server isn't running.

Running a Web server sounds like a big deal, and possibly expensive. It isn't. Microsoft used to make a program called Personal Web Server (PWS) that ran on Windows 95 and 98, but unfortunately it no longer supported in Windows Millennium and is tricky to set up to run Perl. But there are other, better servers around. We've settled on Xitami, because it works straight out the box, is easy to use and (is this beginning to sound familiar?) completely free.

We've bundled Xitami together with ActivePerl - the version of Perl that runs under Windows - into a single set up program on the CD. Fire it up before going further. If you're already using PWS, the installer will give you the choice of using it instead of Xitami. Please read the Using Personal Web Server box before deciding which to use.

Testing Perl

Once the setup is finished and your computer has restarted, it's time to try out your first script. When you're running a Web server on your own computer, your machine becomes the 'localhost'. To view Web pages from the server, open your browser and type http://127.0.0.1 into the address bar. This number is a special IP address that always points to the local server. Most computers will also understand the easier to remember localhost address if you type it into your browser.

Click to view full size

If you get a 'Web page unavailable offline' message when you try to access your server, don't panic.Click 'Connect' - your modem won't dial.

Try it. You'll get a screen saying 'Welcome to Xitami' with lots of information about the program and links to it's documentation. Now make sure Perl is working properly. Type http://127.0.0.1/cgi-bin/test-perl.pl into the address bar. If all's well, you'll get a message saying 'Hello from Perl' and giving you some information about the server environment.

If you run into errors at this point, check Xitami is actually running. If it still doesn't work, the chances are the set up didn't go smoothly. Make sure you're not running another Web server. If not, use Add/Remove Programs in your Control Panel to uninstall Xitami and ActivePerl and run the installer again, making sure you restart your computer when prompted.


NEXT: Setting up a chat room

 1  2  3  Next page 

click here for print version of this story.






|.home|.news|.sites|.free downloads|.tips & tricks|.web builder|.in-depth articles|.magazine|.forums|.contacts|.sitemap|
Copyright Future Publishing 2001. All rights reserved. Reproduction in whole or in part in any form or medium without express written permission from Future Publishing is prohibited. If you have any questions relating to the site, please contact the webmaster.
Click here for our Privacy statement.